<%@ page language="java" contentType="text/html; charset=US-ASCII"
    pageEncoding="US-ASCII"%>
<%@ page import="java.sql.*" %>
<%@ page import="ca.radiologydb.util.Template" %>
<%@ page import="ca.radiologydb.util.ConnectionManager" %>


<%

	Template template = new Template(this.getServletContext().getRealPath("/").toString());
	out.println(template.getTemplateTop());

	ConnectionManager manager = new ConnectionManager();
	Connection conn = manager.getConnection();
	
	Statement stmt = null;
	ResultSet rset = null;
	
	
	String sql = "INSERT INTO family_doctor (patient_name,doctor_name) VALUES ('"+request.getParameter("username")+"','"+request.getParameter("doctor")+"')";
	try {
		stmt = conn.createStatement();
		stmt.executeUpdate(sql);
		
		out.println("<h3>Update was successful!</h3><br />");
		
		out.println("<a href='edit_user.jsp?u="+request.getParameter("username")+"'>Return to edit page</a>.<br />");
		conn.commit();
	}
	catch (Exception ex) {
		out.println("<hr>" + ex.getMessage() + "<hr>");
	}
	
	stmt.close();
	manager.closeConnection();

	out.println(template.getTemplateBottom());
	
%>